package com.moyq5.permit.center.bean.entity;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicUpdate;

import com.moyq5.permit.center.bean.embed.ShopRoleId;

/**
 * 门店角色
 * @author Moyq5
 * @date 2019年7月25日
 */
@Entity
@Table(name = "uc_shop_role")
@DynamicUpdate
public class ShopRole implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	/**
	 * 门店角色ID
	 */
	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "shopId", column = @Column(name = "shop_id", nullable = false, precision = 15, scale = 0)),
			@AttributeOverride(name = "roleId", column = @Column(name = "role_id", nullable = false, precision = 15, scale = 0)) })
	private ShopRoleId id;
	/**
	 * 商户
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "shop_id", nullable = false, insertable = false, updatable = false)
	private Shop shop;
	/**
	 * 角色
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "role_id", nullable = false, insertable = false, updatable = false)
	private SysRole role;
	public ShopRoleId getId() {
		return id;
	}
	public void setId(ShopRoleId id) {
		this.id = id;
	}
	public Shop getShop() {
		return shop;
	}
	public void setShop(Shop shop) {
		this.shop = shop;
	}
	public SysRole getRole() {
		return role;
	}
	public void setRole(SysRole role) {
		this.role = role;
	}
	
}
